﻿using System.Web.Mvc;
using Omu.Awesome.Mvc.Helpers;

namespace Omu.Awesome.Mvc
{
    public class LookupAttribute : MetadataAttribute
    {
        public string Controller { get; set; }

        public string Title { get; set; }

        private bool clearButtonSet;
        private bool clearButton;
        public bool ClearButton
        {
            get { return clearButton; }
            set
            {
                clearButtonSet = true;
                clearButton = value;
            }
        }

        private bool multiselectSet;
        private bool multiselect;
        public bool Multiselect
        {
            get { return multiselect; }
            set
            {
                multiselectSet = true;
                multiselect = value;
            }
        }

        private bool fullscreenSet;
        private bool fullscreen;
        public bool Fullscreen
        {
            get { return fullscreen; }
            set
            {
                fullscreenSet = true;
                fullscreen = value;
            }
        }


        private bool pagingSet;
        private bool paging;
        public bool Paging
        {
            get { return paging; }
            set
            {
                pagingSet = true;
                paging = value;
            }
        }

        public int Width { get; set; }
        public int Height { get; set; }


        public override void Process(ModelMetadata m)
        {
            m.Add(Controller != null, "controller", Controller);
            m.Add(Title != null, "title", Title);
            m.Add(clearButtonSet, "clearButton", ClearButton);
            m.Add(multiselectSet, "multiselect", Multiselect);
            m.Add(fullscreenSet, "fullscreen", Fullscreen);
            m.Add(pagingSet, "paging", Paging);
            m.Add(Width != 0, "width", Width);
            m.Add(Height != 0, "height", Height);
        }
    }
}